<%--
 *  File:    RegionSelect.jsp
 *  @Author: Langerwang 
 *  Date:    2001/12/19
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  Category cat = Category.getInstance("jsp.RegionSelect");  
  String strModuleName = "OGM";
  String strTableName = "ovregion";
%>
<%@ include file="/inc/PageDefault.inc" %>

<html>
<head>
<title>RegionSelect</title>
<PageFlow:CheckPageFlow pageName="regionselect"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<%
  cat.debug("The strCurSearchName is :" + strCurSearchName);
  cat.debug("The strCurSearchValue is :" + strCurSearchValue);  
  cat.debug("The strCurOrderByCol is :" + strCurOrderByCol);
  cat.debug("The strCurOrderByType is :" + strCurOrderByType);
  cat.debug("The nCurMaxItem is :" + nCurMaxItem);  
  cat.debug("The nCurCount is :" + nCurCount);  
  cat.debug("The nCurPageNo is :" + nCurPageNo);
  cat.debug("The nCurTotalPage is :" + nCurTotalPage);
  cat.debug("The nCurEndIndex is :" + nCurEndIndex);
  cat.debug("The bCurHasPre is :" + bCurHasPre);
  cat.debug("The bCurHasNext is :" + bCurHasNext);          
  
  Vector regions = (Vector)pageContext.getAttribute("allregion");
  if(regions == null)
  {
    regions = new Vector();
  }
  cat.debug("The regions is :" + regions);          
%>
<script>
function clickRegion(code,name,id)
{
  document.regionselectform.regioncode.value = code;
  document.regionselectform.regionname.value = name;
  document.regionselectform.regionid.value = id;
  
}

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(regionselectform,actionvalue,orderbyname);
  editform.action = "RegionSelect.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}

function setParentValue()
{
  <%--[SCRIPT]  alert(document.regionselectform.regionid.value);  [SCRIPT]--%>
  <%--[SCRIPT]  alert(document.regionselectform.regioncode.value);    [SCRIPT]--%>
  if(document.regionselectform.regioncode.value != null && document.regionselectform.regioncode.value != -1)
    opener.page_setRegion(document.regionselectform.regioncode.value,document.regionselectform.regionname.value,document.regionselectform.regionid.value);
  
  window.close();
}

</script>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" cellspacing="0" cellpadding="0" height="100%">
<form name="regionselectform" method="post">
    <input type="hidden" name="pagename" value="regionselect">
    <input type="hidden" name="actionname">   
    <input type="hidden" name="languagecode" value="<%=JspHelper.filterNull( session.getAttribute("languagecode") )%>">
                     
    <input type="hidden" name="countrycode" value="<%=JspHelper.filterNull( request.getParameter("countrycode") )%>">
     

    <tr> 
      <td valign="top"> 
        <table width="100%" cellspacing="0" cellpadding="0">
          <tr> 
            <td class="summary_top"></td>
          </tr>
        </table>
        <table width="100%" cellspacing="0" cellpadding="0">
          <%@ include file="/inc/SummarySearch.inc" %>
          <tr> 
            <td height="5" colspan="2" class="summary_top"></td>
          </tr>
        </table>
        
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
          <tr> 
    <tr> 
      <td width="5%" class="deepblue-left">&nbsp;</td>
      <td class="deepblue-left" width="60" nowrap>&nbsp;<a href="javascript:page_summary('orderby','regioncode')"><%= label.getLabelName("L_AreaCode") %></a></td>
      <td class="deepblue-left">&nbsp;<a href="javascript:page_summary('orderby','regionname')"><%= label.getLabelName("L_AreaName") %></a></td>
    </tr>
     <%
        int i = 0;
        String strIsChecked = new String("Checked");
        String strClassType = new String();   
        String strRegionCode = "";     
        String strRegionName = "";
        Integer nRegionid = new Integer("-1");
     %>
     <logic:iterate id="region" collection="<%= regions %>">                      
     <%
       HashMap regionMap = (HashMap)pageContext.getAttribute("region"); 
       if(i%2 == 1)
       {
         strClassType = "td-listrom";
       }else{                    
         strClassType = "";
       }
       if(i != 0)
       {          
         strIsChecked = "";
       }
       else
       {
         strRegionCode = (String)(regionMap.get("regioncode"));         
         strRegionName = (String)(regionMap.get("regionname"));
         nRegionid = (Integer)(regionMap.get("regionid"));
       }  
       i++;        
     %>       
     <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"  onClick="javascript:radiotrue('region<%=JspHelper.filterNull( i )%>');clickRegion('<%=JspHelper.filterNull( regionMap.get("regioncode") )%>','<%=JspHelper.filterNull( regionMap.get("regionname") )%>','<%=JspHelper.filterNull( regionMap.get("regionid") )%>');" class="<%=JspHelper.filterNull( strClassType )%>">
      <td class="<%=JspHelper.filterNull( strClassType )%>"> 
        <input id=region<%=JspHelper.filterNull( i )%> type="radio" name="selectRegion" value="<%=JspHelper.filterNull( regionMap.get("regionid") )%>" <%=JspHelper.filterNull( strIsChecked )%> class="normalradio">
      </td>
      <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( regionMap.get("regioncode") )%></td>
      <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( regionMap.get("regionname") )%></td>
    </tr>
    </logic:iterate> 
    <input type="hidden" name="regioncode" value="<%=JspHelper.filterNull( strRegionCode )%>">    
    <input type="hidden" name="regionname" value="<%=JspHelper.filterNull( strRegionName )%>">
    <input type="hidden" name="regionid" value="<%=JspHelper.filterNull( nRegionid )%>">
                    <% //--------------------------------------  flipping page --%>
    		<%@ include file="/inc/SummaryActionPop.inc" %>
        
      </table>
        <table width="100%" cellspacing="0" cellpadding="0">
          <tr> 
            <td class="summary_top"></td>
          </tr>
          <tr> 
            
    <td class="td_center"><a onclick="setParentValue()"><custom:button type="1" label="L_Finish" imgsrc="finish.gif" border="0" style="width:60"/></a></td>
          </tr>
        </table>
      </td>
    </tr>
            </form>

</table>
</body>
</html>


